<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
<meta content="ViewLocator,com.adobe.cairngorm.view.ViewLocator,getInstance,register,unregister,getViewHelper,registrationExistsFor" name="keywords">
<title>com.adobe.cairngorm.view.ViewLocator</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'ViewLocator - Adobe Consulting EMEA - Cairngorm';
				var baseRef = '../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../index.html?com/adobe/cairngorm/view/ViewLocator.html&amp;com/adobe/cairngorm/view/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;ViewLocator</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class ViewLocator"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.adobe.cairngorm.view</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class ViewLocator</td>
</tr>
</table>
<p></p>
    <p><strong>Deprecated as of Cairngorm 2.1.</strong></p>
    
    The ViewLocator is a singleton class, that is used to retreive ViewHelper
    classes that can manipulate (get/set/switch) the user interface of a
    Cairngorm RIA.
        <p>Model-View-Controller (MVC) best practices specify that command classes 
    should interact with the view using the model (see the ModelLocator class), 
    but in some instance, command classes may require the assistance of 
    ViewHelpers to get/set the user interface associated with the work they 
    are designed to perform.  ViewHelper classes contain methods that allow 
    them to interrogate (get) individual elements of the view, such as the 
    values of form fields, and to update the user interface, such as setting the 
    data provider on DataGrids or Listcomponents.  Additionally, a command may 
    choose to toggle the user interface from one view to another - for instance, 
    to take the user to a checkout screen.</p>
        <p>
    The ViewLocator class is used to allow commands to instantly retrieve
    the appropriate ViewHelper.  A command need only know the canonical
    name of a ViewHelper and the ViewLocator will return an instance of
    the appropriate ViewHelper class.  In this way, command classes can
    manipulate the View irrespective of its implementation.
    </p>
        <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="../model/ModelLocator.html" target="">com.adobe.cairngorm.model.ModelLocator</a>
<br>
<a href="../view/ViewHelper.html" target="">com.adobe.cairngorm.view.ViewHelper</a>
<br>
<a href="../commands/ICommand.html" target="">com.adobe.cairngorm.commands.ICommand</a>
</div>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#ViewLocator()">ViewLocator</a>()</div>
<div class="summaryTableDescription">
       The ViewLocator constructor should only be created
       through the static singleton getInstance() method.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getInstance()">getInstance</a>():<a href="../view/ViewLocator.html">ViewLocator</a>
</div>
<div class="summaryTableDescription">[static]
       Singleton access to the ViewLocator is assured through the static getInstance()
       method, which is used to retrieve the only ViewLocator instance in a Cairngorm
       application.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getViewHelper()">getViewHelper</a>(viewName:String):<a href="../view/ViewHelper.html">ViewHelper</a>
</div>
<div class="summaryTableDescription">
       Retrieves the ViewHelper instance that has previously been registered
       with viewName.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#register()">register</a>(viewName:String, viewHelper:<a href="ViewHelper.html">ViewHelper</a>):void</div>
<div class="summaryTableDescription">
       Registers a viewHelper under a canonical viewName.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#registrationExistsFor()">registrationExistsFor</a>(viewName:String):Boolean</div>
<div class="summaryTableDescription">
       Returns whether a view has been registered with a canonical name.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#unregister()">unregister</a>(viewName:String):void</div>
<div class="summaryTableDescription">
       Unregisters a viewHelper using its canonical name.</div>
</td><td class="summaryTableOwnerCol">ViewLocator</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="ViewLocator()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ViewLocator</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function ViewLocator()</code><p>
       The ViewLocator constructor should only be created
       through the static singleton getInstance() method.  ViewLocator
       maintains a hash map of ViewHelpers, keyed on viewName with a
       particular view as the value stored in the hash map.
       </p></div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="getInstance()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getInstance</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getInstance():<a href="../view/ViewLocator.html">ViewLocator</a></code><p>
       Singleton access to the ViewLocator is assured through the static getInstance()
       method, which is used to retrieve the only ViewLocator instance in a Cairngorm
       application.
              </p><p>Wherever there is a need to retreive the ViewLocator instance, it is achieved
       using the following code:</p>
              <pre>
       var viewLocator:ViewLocator = ViewLocator.getInstance();
       </pre>
       <p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../view/ViewLocator.html">ViewLocator</a></code></td>
</tr>
</table>
</div>
<a name="getViewHelper()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getViewHelper</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function getViewHelper(viewName:String):<a href="../view/ViewHelper.html">ViewHelper</a></code><p>
       Retrieves the ViewHelper instance that has previously been registered
       with viewName.
              </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">viewName</span>:String</code> &mdash; The name of the view for which we wish to retrieve a
       ViewHelper, eg "login"
       </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../view/ViewHelper.html">ViewHelper</a></code></td>
</tr>
</table>
</div>
<a name="register()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">register</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function register(viewName:String, viewHelper:<a href="ViewHelper.html">ViewHelper</a>):void</code><p>
       Registers a viewHelper under a canonical viewName.
              </p><p>In order that the application developer need not know
       the implementation of the view, a ViewHelper capable of manipulating
       a given view is registered under a simple canonical name.</p>
       <p>
       For example, a LoginViewHelper may allow the manipulation of a
       Login window, that may start life as a PopUpWindow, but later be
       changed to a screen in a ViewStack.  By registering the LoginViewHelper
       with the viewName "login", then any code that fetches the ViewHelper
       by it's name "login", and then calls methods on the ViewHelper, is
       completely insulated from any changes in the implementation of the
       view, and the implementation of the ViewHelper.
       </p>
       <p>
       If a view is already registered with the canonical name, and Error
       is thrown.
       </p>
       <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">viewName</span>:String</code> &mdash; A simple canonical name for the view that the ViewHelper
       will manipulate, eg "login"
       </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">viewHelper</span>:<a href="ViewHelper.html">ViewHelper</a></code> &mdash; An instance of a ViewHelper
       </td>
</tr>
</table>
</div>
<a name="registrationExistsFor()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">registrationExistsFor</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function registrationExistsFor(viewName:String):Boolean</code><p>
       Returns whether a view has been registered with a canonical name.
              </p><p>If two views are registered with the same canonical name,
       the second entry will overwrite the first. This method can be used to check
       whether a view has already been registered with a canonical name.</p>
              <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">viewName</span>:String</code> &mdash; canonical name for the view that the ViewHelper will check, eg
       "login"
       </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash; A Boolean that indicates if a view is already registered with that
       view name
       </td>
</tr>
</table>
</div>
<a name="unregister()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">unregister</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function unregister(viewName:String):void</code><p>
       Unregisters a viewHelper using its canonical name.
              </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">viewName</span>:String</code> &mdash; The canonical name for the view to be removed
       </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
